package com.zhongfl.crm.enums.boss;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 订单状态
 *
 * @Author: Mawenlei
 * @Date: 2018/5/3 14:24
 */
@Getter
public enum OrderStatus implements Serializable {

    /**
     * 订单状态
     */
    STATUS_CREATED("10", "已创建", 1),
    STATUS_COLLECT("20", "采集库", 2),
    STATUS_DECLARE("30", "申报库", 3),
    STATUS_APPROVAL("40", "审批库", 4),
    STATUS_PIDAI("50","批贷库",5),
    STATUS_STORAGE("60", "进抵库", 6),
    STATUS_APPLICAT("70", "放款库", 7),
    STATUS_ACCOUNT("80", "入账库", 8),
    STATUS_COMPLETED("90", "已完成", 9),
    STATUS_CANCEL("100", "已取消", 10),
    STATUS_CUSTOM("110", "采报库", 11),
    STATUS_CUSTOM_DELIVER("120", "已受理", 12);

    /**
     * 本来没什么用, 但是为了前端展示状态, 先加一个
     */
    @Getter
    @Setter
    private int index;

    @Setter
    @Getter
    private String key;

    @Setter
    @Getter
    private String value;

    OrderStatus(String key, String value, int index) {
        this.key = key;
        this.value = value;
        this.index = index;
    }

    public static List<OrderStatus> findMajorStatus() {
        List<OrderStatus> orderStatuses = new ArrayList<>(9);
        for (OrderStatus orderStatus : OrderStatus.values()) {
            if (orderStatus.equals(OrderStatus.STATUS_CUSTOM) || orderStatus.equals(OrderStatus.STATUS_CUSTOM_DELIVER)) {
                continue;
            }
            orderStatuses.add(orderStatus);
        }
        return orderStatuses;
    }
}
